package com.jzr.bedside.ui

import android.annotation.SuppressLint
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.google.gson.Gson
import com.jzr.bedside.R
import com.jzr.bedside.base.BaseActivity
import com.jzr.bedside.bean.BedInfoBean
import com.jzr.bedside.utils.CommonUtil
import com.jzr.bedside.utils.PreferUtil
import kotlinx.android.synthetic.main.activity_lock_screen.*

class LockScreenMactivity : BaseActivity(), View.OnClickListener {

    private var data: BedInfoBean? = null

    override fun getLayoutId(): Int {
        return R.layout.activity_lock_screen
    }

    override fun attachView() {

    }

    override fun detachView() {

    }

    @SuppressLint("SetTextI18n")
    override fun initView() {
        rlLayout.setOnClickListener(this)
        val strData = intent.getStringExtra("data")
        val data =  Gson().fromJson<BedInfoBean>(strData,BedInfoBean::class.java)
        tvBedNum.text ="床号: "+ PreferUtil.getInstance().bedName
        if (data != null) {
            tvBedNum.text ="床号: "+ data.data?.bedName
            tvName.text = "姓名: " +data.data?.name
            tvCureNo.text = "住院号: " +data.data?.cureNo
        }
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.rlLayout -> {
                val intent = Intent(this@LockScreenMactivity, MainActivity::class.java)
                startActivityIn(intent,this@LockScreenMactivity)
                finish()
            }
        }
    }

}
